package com.linwen.excise.leetcode;

/**
 * @ClassName _709转换成小写字母
 * @Description TODO
 * @Author zero
 * @DATE 2024/9/22 1:52 AM
 * @Version 1.0
 */
public class _709转换成小写字母 {
    public static void main(String[] args) {
        _709转换成小写字母 inst = new _709转换成小写字母();
        System.out.println(inst.toLowerCase("Hello"));

    }

    public String toLowerCase(String s) {
        if (s == null || s.length() == 0) {
            return s;
        }
        char[] charArray = s.toCharArray();
        for (int i = 0; i < charArray.length; i++) {
            if (charArray[i] >= 'A' && charArray[i] <= 'Z') {
                charArray[i] = (char) (charArray[i] | 32);
            }
        }
        return new String(charArray);
    }
}
